Big refactor and fixed login again!
merge