added functions, other tweaks