Added symbolic constants, refactored some kernel functions.