Again, we cannot aide with custom development... if it's working how you'd like that's great to hear and your code may help others in the future, but it outside the scope of moderator support here, I cannot check your custom code and advise in any way. If you have other issues with the Atom's core, out-of-the-box functionality not working I can help with that.
SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT