various code from open source that may be usful in your project