refactored to match how starcluster does things