add post/preplaces and transitions and reindent the code