refactoring
fixed some issues