Changed back to static polymorphism.

Changed back to static polymorphism and all the bugs that static
polymorphism brought have been fixed.