needs some flags but working