first iteration of working code