Minor improvements, renamed functions