Updated gems and moved code to lib