refactored and fixed bug
Merge branch 'master' into styling
moar styling