optimization and remove warnings