fix threadding (shared data) and use constants