A bit hacky but working