Added If control and moved libraries to lib/