cleanup and safer inputs