cleanup and add more security