Clean up and bug fixes, added stresstest