Cleaned up code, separated compile from mock.