Changed to long instead of int for key-related things