Implemented authentication and fixed few minor bugs.