Removed debug info. Added selection function