Bugfix
Refactor code