solved problem without using eval