partially converting to swift0.3