added remove and some error handling