Refactor code, fix current user bug, refactor javascript