Feature/bug refactor