Fixes && slight refactoring