polishing code. Emacs fucked up the indentation though