Added templated arithmetic functions
Attempt at channel-independent rendering