break platforms into lib, adding tests