various modifications to implementation