Cleanup resubmitted code. Fix clock to use correct headers, function names, removed redefined stuff, etc.