source codes for reference