Some comments and a little bit of refactoring