fixed bug and moved helper