more reliable functionality with custom query