slightly cleaned up