Added Input Filters and Error Handling