hacked up modifications to get this working