refactor inputfields
add some documentation
apply refactoring and optimizations