slight refactoring - still need to convert to arrays