Added file input, fixed small bugs