Little refactoring :)

Added salt to the hash, refactored code and other stuff..