Coding Change

Rebuilt many of the major functions for compact/efficient code