major clenaup and organization of code.