Functions updated. Looks saner