Works... badly, but attempts to work correctly