Initial commit
Some code improvements