working without if statement