updated git ignore
fixed race condition
Added tests and changed makefile structure