Some logic added