Refactore source code

Some naming conventions should be followed and some other minor things. Maybe some more own codings could be relaced by PHP library functions in a more elegant way.

Well, refactoring seems to be a never ending story at last ...