bug in geometry shader fixed, refactoring