Cleaned code and fixed bug where user was not able to choose basic authentication. TODO: Testing and revising contracts.