Moved input handling. resolves #6