Add Pos class and related functions