refactor remove code to be a bit more simple