-code should be cleaner now, should have eliminated all casts