Some security and optimization features and checks added