Start modularizing necessary functions