Fix input
Refactoring js