Fixed bad code; more coming