Added support for multi-threading. Updated Makefile to allow builds with or without threads and architecture specification.