Minor polishing and cleaner code