added decode method that works without returning length
fixed bug introduced in encoder
added serializable class. 3/4 finished