simplified a LOT, have to reimplement loops though