added more structure
logic potentially complete