Moved some parts to commons.