fixed issue #7. Reformatted some indentation issue introduces by Geany. Tried to fix issue number #2 and #3.