Move operation code to trait.

Signed-off-by: crynobone <crynobone@gmail.com>