added decode and encode operations