Added code to thread the ANT class, started also some minor bug fixing.