Small refactor and Ubuntu 14.04 support