solved unregistered user problem but more messy code to clean up