Fixed a bug and uses filter_input to allow console usage