Moved authentication into separate file