example usage
fixed some minor bugs