Cleaned the code up, fixed a memory leak. Refined clock counter to be processor independent.