restructure and add exception + better naming