restructure and added auth