Added Api auth, Api helper and error pages and refactor layouts