Done

The issue #8 has been fixed. I have taken the liberty of fixing some code non-standards (such as some mixes with tabs and spaces, naming convenions, etc.)