Fixed code

t needed to be normalized between 0,1