Fixing the functionality