added threading. fixed mac printing