changed packet handling, removed debug printfs and small fixes