Fixed underscore error. Small refactorings