is working again, cleaned up more code