cleaning code a bit and still testing on ios app