Hansey definitely needs to be safe inside of his cage at night. You can reserve a favorite treat for him specifically for bedtime. Many birds resist being locked up at night, much like a small child resists their bedtime. If he normally is out all day, you may want to adjust his schedule, unless you are always there to supervise him. When a bird is allowed to come and go from his cage at will, this can result in behavioral problems. It is best to take Hansey out of the cage on your hand each time, rather than just opening the door and letting him come out. If the issue is biting when you put him back, then you might want to train him to step up on a stick. Whatever you work out with him, he needs to be in his cage and get at least 8 hours of sleep each night. In fact when a bird gets hormonal during warm weather, it can help to limit the daylight hours to 8-10, giving him a much longer period of sleep at night.
The feather display and song you describe is definitely a mating display. The possible issue is if he gets aggressive due to hormones. This is where limiting daylight can help. But in addition, you need to always limit petting to head scratches because when you pet a bird on the body, you are sending the message that you are a mate. Only a bonded mate can groom another bird on the body. You should also avoid giving him anything that can resemble a nest, anything he can crawl inside of or dark places he might try to hide in. Adult birds only need a nest during breeding season and a single bird should never have a nest, bird tent or anything similar.
Thank you for asking Lafeber,