functional version of login scripts v2