Changed math library to ieee.numeric_std

Also minor cleanup