Removed unused modules and added condition