refactor creation of input layer