finished shared functions