Moved shared code to common library