Fixed bugs in compliance and cleaned up main a little