Clean up kernel and change code to work with ints instead of floats