cleaned up things

Remodeled code to be correct.