Improved input implementation and added input mapping.