some refactoring
switched to 1.9 hash syntax
refactoring, restlying