added seperated login information
cleaned up the code and optimized search