Fixed tests and started working on token handling