Code Cleanup and Some Explanations in the code, more tests :D